@extends('home.public.master')
@section('content')
    <div class="main-container container">
        <ul class="breadcrumb">
            <li><a href="/"><i class="fa fa-home"></i></a></li>
            @foreach($good->getClassifyName($good->id) as $classify)
                <li><a href="{{route('list',$classify)}}">{{$classify->name}}</a></li>
            @endforeach
        </ul>
        <div class="row">
            <div id="content" class="col-md-9 col-sm-8">
                <div class="product-view">
                    <div class="left-content-product">
                        <div class="row">
                            <div class="content-product-left col-md-6 col-sm-12 col-xs-12">
                                <div id="thumb-slider-vertical" class="thumb-vertical-outer">
                                    <!-- <span class="btn-more prev-thumb nt"><i class="fa fa-angle-up"></i></span>
                                    <span class="btn-more next-thumb nt"><i class="fa fa-angle-down"></i></span> -->
                                    <ul class="thumb-vertical">
                                        @foreach($good->pictures as $picture)
                                            <li class="owl2-item">
                                                <a data-index="0" class="img thumbnail" data-image="{{$picture}}">
                                                    <img src="{{$picture}}">
                                                </a>
                                            </li>
                                        @endforeach
                                    </ul>
                                </div>
                                <div class="large-image  vertical">
                                    <img itemprop="image" class="product-image-zoom" src="{{$good->pictures[0]}}"
                                         data-zoom-image="{{$good->pictures[0]}}">
                                </div>
                            </div>
                            <div class="content-product-right col-md-6 col-sm-12 col-xs-12">
                                <div class="title-product">
                                    <h1>{{$good->name}}</h1>
                                </div>

                                <div class="product-label form-group">
                                    <div class="product_page_price price" itemprop="offerDetails" itemscope=""
                                         itemtype="http://data-vocabulary.org/Offer">
                                        <span class="price-new" itemprop="price">{{$good->price}}</span>
                                        <span class="price-old">${{$good->price+mt_rand(20,100)}}</span>
                                    </div>
                                </div>
                                <div style="border: 1px solid orangered;background: orangered;"></div>
                                <form action="" method="post">
                                    @csrf
                                    <div id="product">
                                        <h4>可用选项</h4>
                                        @foreach($good->secondAttr($good->id) as $value)
                                            <div class="image_option_type form-group required">
                                                <label class="control-label">{{$value['name']}}</label>
                                                <ul class="product-options clearfix" id="input-option231">
                                                    {{--循环二级属性--}}
                                                    @foreach($value['son'] as $item)
                                                        <li class="radio {{in_array($item['id'],$product['attributeArr'])?'active':''}}"
                                                            good="{{$item['id']}}">
                                                            <label>
                                                                <img
                                                                    style="border: 2px solid #DDDDDD; padding: 1px;width: 20px;height: 20px; "
                                                                    src="{{asset('shop/ico/kongbai.png')}}" alt="">
                                                                <i style="color: black;" class="fa fa-check"></i>
                                                                <label>{{$item['name']}}</label>
                                                            </label>
                                                        </li>
                                                    @endforeach
                                                    {{--二级属性循环结束--}}
                                                    <li class="selected-option">
                                                    </li>
                                                </ul>
                                            </div>
                                        @endforeach
                                        <hr>
                                        <div class="card-body">
                                            <span>库存: {{$product['inventory']}}  </span><span class="inventory"></span>
                                        </div>
                                        <hr>
                                        <div class="form-group box-info-product mt-5">
                                            <div class="option quantity">
                                                <div class="input-group quantity-control" unselectable="on"
                                                     style="-webkit-user-select: none;">
                                                    <label>数量</label>
                                                    <input class="form-control inventorys" type="text" name="quantity"
                                                           value="1">
                                                    <input type="hidden" name="product_id" value="50">
                                                    <span class="input-group-addon product_quantity_down">−</span>
                                                    <span class="input-group-addon product_quantity_up">+</span>
                                                </div>
                                            </div>
                                            <div class="cart">
                                                <input type="button" data-toggle="tooltip" title="" value="加入购车车"
                                                       data-loading-text="Loading..." id="button-cart"
                                                       class="btn btn-mega btn-lg" onclick="cartAdd();"
                                                       data-original-title="加入购物车">
                                            </div>
                                            <div class="add-to-links wish_comp">
                                                <ul class="blank list-inline">
                                                    <li class="wishlist">
                                                        @if(!$collect)
                                                            <a href="{{route('collect.clickCollect',$good['id'])}}"
                                                               class="icon" data-toggle="tooltip"
                                                               data-original-title="收藏"><i
                                                                    class="fa fa-heart"></i>
                                                            </a>
                                                        @else
                                                            <a href="{{route('collect.offCollect',$good['id'])}}"
                                                               class="icon" data-toggle="tooltip"
                                                               data-original-title="取消收藏"><i
                                                                    class="fa fa-heart" style="color: red;"></i>
                                                            </a>
                                                        @endif
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>

                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- Product Tabs -->
                <div class="producttab ">
                    <div class="tabsslider horizontal-tabs  col-xs-12">
                        <ul class="nav nav-tabs">
                            <li class="active"><a data-toggle="tab" href="#tab-1">描述</a></li>
                            <li class="item_nonactive"><a data-toggle="tab" href="#tab-review">评论 (1)</a></li>
                        </ul>
                        <div class="tab-content col-xs-12">
                            <div id="tab-1" class="tab-pane fade active in">
                                {!! $good['details'] !!}
                            </div>
                            <div id="tab-review" class="tab-pane fade">
                                <form>
                                    <div id="review">
                                        <table class="table table-striped table-bordered">
                                            <tbody>
                                            <tr>
                                                <td style="width: 50%;"><strong>发布评论的人</strong></td>
                                                <td class="text-right">发布评论的时间</td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <p>评论内容</p>
                                                    <div class="ratings">
                                                        <div class="rating-box">
                                                            @foreach([1,2,3,4,5] as $k=>$v)
                                                                @if($k<=mt_rand(3,5))
                                                                    <span class=",fa fa-stack">
                                                                <i class="fa fa-star fa-stack-2x"></i>
                                                            </span>
                                                                @endif
                                                            @endforeach
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        <div class="text-right"></div>
                                    </div>
                                    <h2 id="review-title">发评论</h2>
                                    <div class="contacts-form">
                                        <div class="form-group"><span class="icon icon-bubbles-2"></span>
                                            <textarea class="form-control" name="text"
                                                      onblur="if (this.value == '') {this.value = 'Your Review';}"
                                                      onfocus="if(this.value == 'Your Review') {this.value = '';}">留下您的宝贵意见...</textarea>
                                        </div>
                                        <div class="form-group">
                                            <b>评价</b> <span>差</span>&nbsp;
                                            <input type="radio" name="rating" value="1"> &nbsp;
                                            <input type="radio" name="rating"
                                                   value="2"> &nbsp;
                                            <input type="radio" name="rating"
                                                   value="3"> &nbsp;
                                            <input type="radio" name="rating"
                                                   value="4"> &nbsp;
                                            <input type="radio" name="rating"
                                                   value="5"> &nbsp;<span>非常好</span>

                                        </div>
                                        <div class="buttons clearfix"><a id="button-review"
                                                                         class="btn buttonGray">发布</a>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- //Product Tabs -->

                <!-- Related Products -->
                <div class="related titleLine products-list grid module ">
                    <h3 class="modtitle" style="margin-bottom: 20px;">相关商品</h3>

                    <div class="releate-products yt-content-slider products-list" data-rtl="no" data-loop="yes"
                         data-autoplay="no" data-autoheight="no" data-autowidth="no" data-delay="4" data-speed="0.6"
                         data-margin="30" data-items_column00="5" data-items_column0="5" data-items_column1="3"
                         data-items_column2="3" data-items_column3="2" data-items_column4="1" data-arrows="yes"
                         data-pagination="no" data-lazyload="yes" data-hoverpause="yes">

                        {{--相关商品循环开始--}}
                        @foreach($good->goodbroth($good['id']) as $k=> $value)
                            @if($k<10)
                                {{--<div class="product-layout col-lg-15 col-md-4 col-sm-6 col-xs-12 text-center">--}}
                                <div class="item">
                                    <div class="item-inner product-layout transition product-grid">
                                        <div class="product-item-container">
                                            <div class="left-block left-b" style="width: 200px; height: 200px;">

                                                <div class="product-image-container second_img">
                                                    <a style="width: 190px; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" href="{{route('showGoods',$value)}}" target="_self" >
                                                        <img src="{{$value['pictures'][0]}}" class="img-1 img-responsive" >
                                                        <img src="{{$value['pictures'][0]}}" class="img-2 img-responsive" >
                                                    </a>
                                                </div>
                                                <!--quickview-->
                                                <div class="so-quickview">
                                                    <a class="iframe-link btn-button quickview quickview_handler visible-lg" href="{{route('quickView',$value)}}" title="Quick view" data-fancybox-type="iframe"><i class="fa fa-eye"></i><span>快速查看</span></a>
                                                </div>
                                                <!--end quickview-->


                                            </div>
                                            <div class="right-block">
                                                <div class="button-group so-quickview cartinfo--left">
                                                    <a href="{{route('showGoods',$value)}}">  <button type="button" class="addToCart" >
                                                            <span>去加入购物车</span>
                                                        </button></a>
                                                    @if(!$value->is_collect($value->id))
                                                        <a href="{{route('collect.clickCollect',$value['id'])}}">
                                                            <button type="button" class="btn-button" title="收藏"
                                                            ><i class="fa fa-heart-o"></i><span>收藏</span>
                                                            </button>
                                                        </a>
                                                    @else
                                                        <a href="{{route('collect.clickCollect',$value['id'])}}">
                                                            <button type="button" class="btn-button" title="取消收藏"
                                                            ><i style="color: red;"
                                                                class="fa fa-heart-o"></i><span>取消收藏</span>
                                                            </button>
                                                        </a>
                                                    @endif

                                                </div>
                                                <div class="caption hide-cont">
                                                    <div class="ratings">
                                                        <div class="rating-box">
                                                            @foreach([1,2,3,4,5] as $k=>$v)
                                                                @if($k<=mt_rand(3,5))
                                                            <span class=",fa fa-stack">
                                                                <i class="fa fa-star fa-stack-2x"></i>
                                                            </span>
                                                                @endif
                                                            @endforeach
                                                        </div>
                                                    </div>
                                                    <h4 style="width: 190px; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"><a href="{{route('showGoods',$value)}}" target="_self">{{$value->name}}</a></h4>

                                                </div>
                                                <p class="price">
                                                    <span class="price-new">¥{{$value->price}}</span>

                                                </p>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                            @endif
                        @endforeach
                        {{--相关产品循环结束--}}
                    </div>
                </div>

                <!-- end Related  Products-->


            </div>
            <!--Middle Part End-->
            <!--Left Part Start -->
            <aside class="col-sm-4 col-md-3 content-aside" id="column-left">
                <div class="module category-style">
                    <h3 class="modtitle">分类</h3>
                    <div class="modcontent">
                        <div class="box-category">
                            <ul id="cat_accordion" class="list-group">
                                {{--此商品对应的三级分类放在这里循环--}}
                                @foreach($good->getThird($good['id']) as $value)
                                    <li class=""><a href="{{route('list',$value)}}"
                                                    class="cutom-parent">{{$value['name']}}</a> <span
                                            class="dcjq-icon"></span></li>
                                @endforeach

                            </ul>
                        </div>
                    </div>
                </div>
                <div class="module product-simple">
                    <h3 class="modtitle">
                        <span>新品</span>
                    </h3>
                    <div class="modcontent">
                        <div class="so-extraslider">
                            <!-- Begin extraslider-inner -->
                            <div class="extraslider-inner">
                                <div class="item ">
                                    @foreach($good->goodbroth($good['id']) as $k=> $value)
                                        @if($k<4)
                                            <div class="product-layout item-inner style1 ">
                                                <div class="item-image">
                                                    <div class="item-img-info">
                                                        <a href="{{route('showGoods',$value)}}" target="_self"
                                                           title="Mandouille short ">
                                                            <img src="{{$value->pictures[0]}}"
                                                                 alt="Mandouille short">
                                                        </a>
                                                    </div>
                                                </div>
                                                <div class="item-info">
                                                    <div class="item-title"
                                                         style="width: 150px; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
                                                        <a href="{{route('showGoods',$value)}}" target="_self"
                                                           title="Mandouille short">{{$value->name}}</a>
                                                    </div>
                                                    <div class="rating">
                                                        <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i></span>
                                                        <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i></span>
                                                        <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i></span>
                                                        <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i></span>
                                                        <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i></span>
                                                    </div>
                                                    <div class="content_price price">
                                                        <span class="price-new product-price">${{$value->price}}
                                                            .00 </span>&nbsp;&nbsp;

                                                        <span class="price-old">${{$value->price+mt_rand(10,200)}}
                                                            .00 </span>&nbsp;

                                                    </div>
                                                </div>
                                                <!-- End item-info -->
                                                <!-- End item-wrap-inner -->
                                            </div>
                                        @endif
                                    @endforeach
                                </div>
                            </div>
                            <!--End extraslider-inner -->
                        </div>
                    </div>
                </div>
                <div class="module banner-left hidden-xs ">
                    <div class="banner-sidebar banners">
                        @foreach($good->goodbroth($good['id']) as $k=> $value)
                            @if($k==mt_rand(0,count($good->goodbroth($good['id']))))
                                <div>
                                    <a title="Banner Image" href="{{route('showGoods',$value)}}">
                                        <img src="{{$value->pictures[0]}}"
                                             alt="Banner Image">
                                    </a>
                                </div>
                            @endif
                        @endforeach
                    </div>
                </div>
            </aside>
            <!--Left Part End -->
        </div>
    </div>
@endsection
@section('footer')
    <div id="sp-cpanel_btn" class="isDown visible-lg">
        <i class="fa fa-cog"></i>
    </div>
@endsection
@push('js')
    @include('home.public.addToCart')
@endpush
